<?php
/*
 * @Author: your name
 * @Date: 2021-12-07 09:50:02
 * @LastEditTime: 2022-03-10 20:59:26
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \property\app\Http\Controllers\find_shop\User.php
 */

namespace App\Http\Controllers\find_shop;

use Illuminate\Support\Facades\Request;
// use  App\Http\Controllers\redis\RedisController as Redis;
use  App\Models\admin_model\Store as StoreDB;

class Store extends BaseController
{
    public function storeList()
    {
            $whereStr = '';
            $limitStr = '';
            if (Request::input('pageSize') && Request::input('page')) {
                $limitStr =   limit_joint(Request::input('page'), Request::input('pageSize'));
            }
        if (Request::has('keyWord')) {

            $whereStr = mysql_or_and( Request::input('keyWord'));
        }
            $list  =   StoreDB::storeWebList($whereStr, $limitStr);
            return $this->create(200, '查询成功', $list);
       
    }

    public function storeSelOne(){
        if(Request::has('id')){
            $id =Request::input('id');
             $user =  new User;
             $res =   $user->checkToken(false)? StoreDB::storeSelOneCollect($id,$this->getLoginMsg()):StoreDB::storeSelOne($id);
            if($res){
              return $this->create(200, '查询成功', $res[0]);
            }
        }
    }

    public function storeWebListRand()
    {
        if (Request::has('limit') && Request::has('id')) {
            return $this->create(200, '查询成功', StoreDB::storeWebListRand(Request::input('id'),Request::input('limit')));
        }
    }
    

    // public function storeList
}
